/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asportoonline.business.delegates;

import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author fe
 */
public abstract class AbstractDelegate {
    /*
     * Deve ritornare il nome JNDI del servizio
     */
    protected abstract String getServiceName();
    
    // Accesso al servizio
    protected Object getService() {
        InitialContext context;
        Object lookup;
        
        try {
            context = new InitialContext();
            lookup = context.lookup(getServiceName());
            return lookup;
        } catch (NamingException exp) {
            System.out.println("NamingException in getService()  of  AbstractDelegate");
            return new Object();
        }
    }
}
